<?php
/**
 * 首页->每日考勤
 * 按日期查询
 * @author dinglin
 *
 */
apf_require_class('Oa_Test_AbstractTest');
class Oa_Test_Util_MoreTest extends Oa_Test_AbstractTest {

    private $controller;
    public function setUp(){
        //apf_require_controller('Oa_Attendance_MyIndexController');
        $this->controller = APF::get_instance()->get_controller('Oa_Attendance_MyIndexController');
    }
    public function tearDown(){
        unset($this->controller);
    }
    /**
     * @dataProvider data_main_Search
     * 主逻辑测试
     * 主要测试搜索异常情况，正常情况同IndexTest.php
     */
    public function test_main_Search($params,$expect){
        $result = $this->controller->get_attendance_list_new($params);
        if(!empty($expect)){
            $temp_key = array();
            foreach($result as $key=>$value){
                $temp_key[]=$key;
            }
            $result = $temp_key;
        }
        $this->assertEquals($expect,$result,"主页搜索");
    }
    public function data_main_Search(){
        $now_days = array();
        $time = time();
        $i = 0;
        while($i<7){
            $now_days[] = intval(date('Ymd',$time));
            $time = $time-24*60*60;
            $i++;
        }
        return
        array(
                array(array('start'=>'2012-11-06','end'=>''),array()),
                array(array('start'=>'','end'=>'2012-11-09'),array()),
                array(array('start'=>'','end'=>''),$now_days),
                array(array('start'=>'2012-11-06','end'=>'2012-11-09'),array(20121109,20121108,20121107,20121106)),//此期望值验证个数和时间
                array(array('start'=>'2012-11-01','end'=>'2012-11-09'),array(20121109,20121108,20121107,20121106,20121105,20121104,20121103)),
        );
    }
}